﻿<?php
require_once '../include/common.inc.php';
require_once '../include/upfile.class.php';

if (!checkAdmin()) {
    header("LOCATION:index.php");
    exit;
}

$sql="DELETE FROM product_p_setting";
if($db->query($sql))
{
	$sql = "SELECT `id`,`setting_id` FROM `product` ";
	$query = $db->query($sql);
	while($rs=$db->fetch_array($query))
	{
	 if($rs['setting_id']!=0&&trim($rs['setting_id'])!='')
	 {
	   $sqlin="INSERT INTO `product_p_setting`(`setting_id`,`product_id`) values('".$rs['setting_id']."','".$rs['id']."')";
	   //echo $sqlin."<br/>";
	  // echo $db->query($sqlin)."<br/>";
	   
	 }
	 // $db->query($sqlin);
	  //echo $db->query($sqlin)."<br/>";
	}
}
//echo $sql_all_num;
?>